package com.usian.behavior.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.usian.behavior.service.ApFollowBehaviorService;
import com.usian.model.behavior.pojos.ApFollowBehavior;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/v1/followBehavior")
public class ApFollowBehaviorController {

    @Autowired
    ApFollowBehaviorService apFollowBehaviorService;


    /**
     * 远程调用，提供查询用户关注行为接口
     * @param entryId
     * @param articleId
     * @param followId
     * @return
     */
    @GetMapping("/findFollowBehavior/{entryId}/{articleId}/{followId}")
    public List<ApFollowBehavior> saveFollowBehavior(@PathVariable Integer entryId,
                                                     @PathVariable Long articleId,
                                                     @PathVariable Integer followId) {
       return apFollowBehaviorService.list(Wrappers.<ApFollowBehavior>lambdaQuery()
                .eq(ApFollowBehavior::getEntryId, entryId)
                .eq(ApFollowBehavior::getArticleId, articleId)
                .eq(ApFollowBehavior::getFollowId, followId));

    }
}
